<template>
 <el-table
    ref="filterTable"
    :data="eventData" 
    border
    style="width: 100%">
    <!-- <el-table-column
      prop="date"
      label="日期"
      sortable
      column-key="date"
      :filters="[{text: '2016-05-01', value: '2016-05-01'}, {text: '2016-05-02', value: '2016-05-02'}, {text: '2016-05-03', value: '2016-05-03'}, {text: '2016-05-04', value: '2016-05-04'}]"
      :filter-method="filterHandler"
    >
    </el-table-column> -->
    <el-table-column
      prop="tag"
      label="标签"
      width="80"
      v-bind:filters="eventTypes"
      :filter-method="filterTag"
      filter-placement="bottom-end">
      <template slot-scope="scope">
        <!-- scope.row.tag === '地震' ? 'primary' : 'success' -->
        <el-tag
          :type="tagType(scope.row.tag)"
          disable-transitions>{{scope.row.tag}}</el-tag>
      </template>
    </el-table-column>
    <el-table-column
      prop="requestPhone"
      label="电话号码"
      width="120"
      >
    </el-table-column>
    <el-table-column
      prop="latitude"
      label="地址"
      >
    </el-table-column>
      <el-table-column
      prop="longitude"
      label="地址"
      >
    </el-table-column>
    <el-table-column
      prop="requestDescription"
      label="描述"
      >
    </el-table-column>

  </el-table>
</template>
<script>
import { getRequest } from "../utils/api";
import { putRequest } from "../utils/api";
import "../css/EventTable.css"

export default {
  data() {
    return {
       

       //tag是传来的值，表项；test为下拉的值；；value就为value
        eventTypes:[{ text: '地震', value: '地震' },
                    { text: '洪水', value: '洪水' },
                    { text: '火灾', value: '火灾' },
                    { text: '户外', value: '户外' },
                    { text: '其他', value: '其他' }]
    };
  },
  computed:{
    eventStatus(){
        if(this.status=1){return "未审核"}
    },
    
  },
  mounted: function () {
  },
  methods: {
      filterTag(value, row) {
        return row.tag === value;
      },
      filterHandler(value, row, column) {
        const property = column['property'];
        return row[property] === value;
      },
      tagType(tag){
      if(tag === '地震')
        return 'danger' 
      else if(tag=='洪水')
        return 'warning'
      else if(tag==="火灾")
        return 'info'
      else if(tag==="户外")
        return 'primary'
      else
        return 'success'
    }
  },
  // props:["status","eventType","phone","position","describe"]
  props:["eventData"]
};
</script>



 // tableData: [{
        //   describe:"啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇呃呃呃呃呃呃呃呃呃呃呃",
        //   phone:12452687254,
        //   date: '2016-05-02',
        //   name: '王小虎',
        //   address: '上海市普陀区金沙江路 1518 弄',
        //   tag: '地震'
        // }, {
        //   describe:"啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇呃呃呃呃呃呃呃呃呃呃呃",
        //   phone:12452687254,
        //   date: '2016-05-04',
        //   name: '王小虎',
        //   address: '上海市普陀区金沙江路 1517 弄',
        //   tag: '洪水'
        // }, {
        //   describe:"啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇呃呃呃呃呃呃呃呃呃呃呃",
        //   phone:12452687254,
        //   date: '2016-05-01',
        //   name: '王小虎',
        //   address: '上海市普陀区金沙江路 1519 弄啊啊啊啊啊啊啊啊啊',
        //   tag: '地震'
        // }, {
        //   describe:"啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇哇呃呃呃呃呃呃呃呃呃呃呃",
        //   phone:12452687254,
        //   date: '2016-05-03',
        //   name: '王小虎',
        //   address: '上海市普陀区金沙江路 1516 弄',
        //   tag: '户外'
        // }],